<template>
  <div id="app">
    <transition name="ly" mode="out-in">
      <keep-alive>
        <component :is="coms[chekebox]"></component>
      </keep-alive>
    </transition>
    <div class="botton">
      <span
        v-for="(item, index) in orders"
        :key="index"
        @click="chekebox = index"
        :class="{ active: chekebox == index }"
        >{{ item.name }}</span
      >
    </div>
  </div>
</template>

<script>
import Mine from "./components/mine.vue";
import Order from "./components/orders.vue";
import Index from "./components/index.vue";
import Tuan from "./components/baobaotuan.vue";

export default {
  name: "App",
  data() {
    return {
      chekebox: 2,
      coms: [Index, Tuan, Order, Mine],
      orders: [
        { id: 1, name: "首页" },
        { id: 2, name: "爆爆团" },
        { id: 3, name: "订单" },
        { id: 4, name: "我的" },
      ],
    };
  },
  components: {},
};
</script>

<style>
* {
  padding: 0;
  margin: 0;
}
.botton {
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  bottom: 0;
  background-color: white;
  border-top: 1px solid rgb(177, 174, 174);
}
.botton span {
  height: 100%;
  padding: 10px;
  line-height: 40px;
}
.botton span.active {
  color: rgb(16, 172, 207);
}

.ly-enter {
  /* 入场动画的初始状态 */
  opacity: 0;
  transform: scale(0);
}
.ly-enter-active {
  /* 入场动画执行过程中的状态 */
  transition: all 0.5s;
}
.ly-enter-to {
  /* 入场动画执行结束时的状态 */
  opacity: 1;
    transform: scale(1);
}

.ly-leave {
  /* 离场动画的初始状态 */
  /* opacity: 1; */
  transform:  scale(1);
}
.ly-leave-active {
  /* 离场动画执行过程中的状态 */
  transition: all 0.5s;
}
.ly-leave-to {
  /* 离场动画执行结束时的状态 */
  /* opacity: 0; */
  transform:  scale(0);
}
</style>
